/// 关于table view的操作

public protocol GroupTableViewDelegate {

    associatedtype TypeCellHolder;
    associatedtype TypeData;


    /// 获取布局的文件名或者id
    ///
    /// - Parameters:
    ///   - groupIndex: 组下标
    ///   - childIndex: 子下标
    func getIBName(section: Int, row: Int) -> String;

    /// 获取每个section的row数量
    ///
    /// - Parameter section:
    func numberOfRows(in section: Int) -> Int;

    /// 点击了整个cell
    ///
    /// - Parameters:
    ///   - section:
    ///   - row:
    func didSelectRow(section: Int, row: Int);


    /// 初始化cell, 只调用一次
    ///
    /// - Parameters:
    ///   - section:
    ///   - row:
    ///   - holder:
    func initCellForRow(section: Int, row: Int, with holder: TypeCellHolder);

    ///
    /// 刷新cell, 每次刷新都调用
    ///
    /// - Parameters:
    ///   - section:
    ///   - row:
    ///   - holder:
    func refreshCellForRow(section: Int, row: Int, with holder: TypeCellHolder);

    /// 获取item
    ///
    /// - Parameter index:
    func getItem(at index: Int) -> TypeData?;

    /// 添加item
    ///
    /// - Parameter item:
    func add(item: TypeData?);

    /// 删除item
    ///
    /// - Parameter index:
    func remove(at index: Int);

    /// 获取item集合
    ///
    /// - Returns:
    func getData() -> Array<TypeData>?;

    /// 设置点击事件
    ///
    /// - Parameters:
    ///   - section:
    ///   - row:
    ///   - v:
    func setOnTapListener(section: Int, row: Int, v: UIView?);

    /// 响应点击事件
    ///
    /// - Parameters:
    ///   - section:
    ///   - row:
    ///   - v:
    func onTap(section: Int, row: Int, v: UIView?);
}


public protocol TableViewDelegate {
    associatedtype CellHolder;

    /// 获取布局的文件名或者id
    func getIBName(row: Int) -> String;

    /// 点击了整个cell
    func didSelectRow(row: Int);

    /// 初始化cell
    func initCellForRow(row: Int, with holder: CellHolder);

    /// 刷新cell
    func refreshCellForRow(row: Int, with holder: CellHolder);

    /// 设置点击事件
    func setOnTapListener(row: Int, v: UIView?);

    /// 响应点击事件
    func onTap(row: Int, v: UIView?);
}


/// 持有cell, 提供一下额外的方法

open class IBCellHolder: UITableViewCell {

    required public init?(coder aDecoder: NSCoder) {
        super.init(coder: aDecoder);
    }
}



